package com.jg.visitor;

import com.jg.visitor.controller.enums.VisitorApplyRecordStatusEnum;

import java.util.*;

public class GlobalConst {
    /**
     * 时间基本格式
     */
    public static final String TIME_FORMAT_BASE = "yyyy-MM-dd HH:mm:ss";
    public static final String TIME_FORMAT_DAY = "yyyyMMdd";
    public static final String TIME_FORMAT_YEAR = "yyyy";

    /**
     * token
     */
    public static final String VISITOR_TOKEN = "visitor_token";
    public static final String ADMIN_TOKEN = "admin_token";

    /**
     * 获取openid基本路径
     */
    public static final String OPENID_BASE_URL = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=%s";

    /**
     * 微信公众号获取全局token
     */
    public static final String WX_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";

    /**
     * 微信发送模版消息
     */
    public static final String SEND_MESSAGE_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=%s";


    /**
     * openId获取时的错误码
     */
    public static final int SYSTEM_BUSY = -1;
    public static final int INVALID_CODE = 40029;
    public static final int REQUEST_ACCOUNT_ERROR = 45011;
    public static final int USER_DANGEROUS = 40226;

    /**
     * 用户类型
     */
    public static final Integer USER_TYPE_VISITOR = 0;
    public static final Integer USER_TYPE_INTERVIEWEE = 1;
    public static final Integer USER_TYPE_SAFETY_OFFICER = 2;
    public static final Integer USER_TYPE_ADMIN = 3;
    public static final List<Integer> ADMIN_USER_TYPE_LIST = Arrays.asList(USER_TYPE_INTERVIEWEE,USER_TYPE_SAFETY_OFFICER,USER_TYPE_ADMIN);

    /**
     * 用户名称map
     */
    public static Map<Integer,String> GET_USERTYPE_NAME_MAP(){
        Map<Integer,String> map = new HashMap<>();
        map.put(USER_TYPE_VISITOR,"访客");
        map.put(USER_TYPE_INTERVIEWEE,"被访者");
        map.put(USER_TYPE_SAFETY_OFFICER,"安全员");
        map.put(USER_TYPE_ADMIN,"超级管理员");
        return map;
    }

    /**
     * 缓存名称 对应配置文件的缓存名称
     */
    public static final String VISITOR_PASS_CODE = "visitor_pass_code";
    public static final String GLOBAL_CONFIG_CODE = "visitor_global_config";
    public static final String WECHAT_GLOBAL_TOKEN = "wechat_global_token";
    public static final String LOGIN_VISITOR = "login_visitor";
    public static final String LOGIN_ADMIN = "login_admin";
    public static final String LICENSE_CONFIG = "visitor_license_config";
    /**
     * 缓存 key
     */
    public static final String GLOBAL_CONFIG_KEY = "visitor.global.config:";
    public static final String WECHAT_GLOBAL_TOKEN_KEY = "visitor.global.config:";
    public static final String LOGIN_VISITOR_TOKEN_KEY = "login.visitor:";
    public static final String LOGIN_ADMIN_TOKEN_KEY = "login.admin:";
    public static final String LICENSE_CONFIG_KEY = "visitor_license_config";
    /**
     * 操作同意或者拒绝
     */
    public static final Integer APPLY = 1;
    public static final Integer REFUSE = 2;

    /**
     * 是否管理员操作
     */
    public static final Integer ADMIN_FLAG_TRUE = 1;
    public static final Integer ADMIN_FLAG_FALSE = 2;

    /**
     * 配置表key
     */
    public static final String MAX_SELECT_TIME_KEY = "visitor_max_choose_days";
    public static final String COMPANY_DOOR_SETTING = "company_door_setting";
    public static final String NUCLEIC_REPORT_SETTING = "nucleic_acid_report_show";

    /**
     * 访客申请单待审核 已审核
     */
    public static final Integer WAIT_APPROVE = 1;
    public static final Integer APPROVED = 2;

    /**
     * 访客申请待审核状态集合
     */
    public static final List<Integer> VISITOR_APPLY_RECORD_WAIT_APPROVE =
            Arrays.asList(
                    VisitorApplyRecordStatusEnum.WAIT_RESPONDENTS_APPROVE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.WAIT_SAFER_APPROVE.getStatusCode()
            );
    /**
     * 访客申请已审核状态集合
     */
    public static final List<Integer> VISITOR_APPLY_RECORD_APPROVED =
            Arrays.asList(
                    VisitorApplyRecordStatusEnum.PASS.getStatusCode(),
                    VisitorApplyRecordStatusEnum.SAFER_REFUSE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.APPROVE_TIME_OUT.getStatusCode(),
                    VisitorApplyRecordStatusEnum.RESPONDENTS_REFUSE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.SIGN_IN.getStatusCode(),
                    VisitorApplyRecordStatusEnum.SIGN_OUT.getStatusCode(),
                    VisitorApplyRecordStatusEnum.CANCEL.getStatusCode()
            );
    /**
     * 访客申请待审核已审核map
     */
    public static Map<Integer,List<Integer>> GET_APPLY_RECORD_STATUS_CONVERT_MAP(){
        Map<Integer,List<Integer>> map = new HashMap<>();
        map.put(WAIT_APPROVE,VISITOR_APPLY_RECORD_WAIT_APPROVE);
        map.put(APPROVED,VISITOR_APPLY_RECORD_APPROVED);
        return map;
    }

    /**
     * 已完成的申请单状态
     */
    public static final List<Integer> VISITOR_APPLY_RECORD_COMPLETE =
            Arrays.asList(
                    VisitorApplyRecordStatusEnum.SAFER_REFUSE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.APPROVE_TIME_OUT.getStatusCode(),
                    VisitorApplyRecordStatusEnum.RESPONDENTS_REFUSE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.SIGN_IN.getStatusCode(),
                    VisitorApplyRecordStatusEnum.SIGN_OUT.getStatusCode(),
                    VisitorApplyRecordStatusEnum.CANCEL.getStatusCode()
            );

    /**
     * 访客申请单被拒绝
     */
    public static final List<Integer> VISITOR_APPLY_RECORD_REFUSED =
            Arrays.asList(
                    VisitorApplyRecordStatusEnum.SAFER_REFUSE.getStatusCode(),
                    VisitorApplyRecordStatusEnum.RESPONDENTS_REFUSE.getStatusCode()
            );

    /**
     * base64 header
     */
    public static final String BASE64_HEADER_IMG = "data:image/png;base64,";

    /**
     * test token
     */
    public static final String TEST_OPEN_ID = "oVCu05YR4IsuD3xfQ0VGvFwYJQTs";

    /**
     * 环境
     */
    public static final String ENVIRONMENT_PRO = "pro";

    /**
     * admin用户
     */
    public static final String ADMIN_USER = "admin";

    /**
     * aes iv
     */
    public static final String IV = "0102030405060708";
    public static final String DEFAULT_AES_KEY = "1234567890123456";

    /**
     * rsa private_key
     */
    public static final String RSA_PUBLIC_KEY = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzxn/Lt3/oeujQ81CJ4J3\n" +
            "16wS0ucUO4/Q0q3SsJkf3JatE2HonscEujh4kL0LrjSQ/ZbWNKPTeGxCOFIRoX5e\n" +
            "KK85M7q9UNQt1PTOIV1+wF2DnOiduHnuhJc246n6T4ItdEzRsXXEyXglo5Y+2zRW\n" +
            "IknmyaEW5Pi1sjAUSVT2C+IyF9vFdIbGPexRW34Po8bxF2ti1Tsv35Dds9SoW3ar\n" +
            "ApcFazr529+igPzejVWvftIZ+qC7VCV2Ko7oDBptQ34hxhmIaUdiLOSaRA736AzX\n" +
            "PEwH1GkZwYFNpZ32WQO7Q5cdJ7mLN5BDfsk3iUl4LjrTR/fU67UmeFTIngOathiE\n" +
            "O05QsLFELJIyN1BvaNmY58AMpLAeAhbBbxDSHmbP3nENh8fG1nZoHe+agZDEt0tq\n" +
            "m/PuQ5fxnxIxgZgzL1BeZYHu9v5c6OUhEBi5GzorHkNngbY4ipAQWrxd65qaqTml\n" +
            "VJaUNPfREKItdPegEfmwEtXbkoobOATRfOXtxL87cmUW/WLWy8QTsV1aFp1uy3Mp\n" +
            "4oflWV8gaWNgK6tUUAVdilp8VK+FJZ4d6evGRIO2vJA3wvd4JDv8OK+0/CuRravB\n" +
            "kDZXEXk995R8vOwK+jvHw7NPuJUF1LJYD9W4Tgl1rnoye8eTCLBTA7wOKCeWU4eS\n" +
            "rUJq0uNyzvMYBb4Hg4LuA3MCAwEAAQ==";
    /**
     * rsa_public_key
     */
    public static final String RSA_PRIVATE_KEY = "MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDPGf8u3f+h66ND\n" +
            "zUIngnfXrBLS5xQ7j9DSrdKwmR/clq0TYeiexwS6OHiQvQuuNJD9ltY0o9N4bEI4\n" +
            "UhGhfl4orzkzur1Q1C3U9M4hXX7AXYOc6J24ee6ElzbjqfpPgi10TNGxdcTJeCWj\n" +
            "lj7bNFYiSebJoRbk+LWyMBRJVPYL4jIX28V0hsY97FFbfg+jxvEXa2LVOy/fkN2z\n" +
            "1KhbdqsClwVrOvnb36KA/N6NVa9+0hn6oLtUJXYqjugMGm1DfiHGGYhpR2Is5JpE\n" +
            "DvfoDNc8TAfUaRnBgU2lnfZZA7tDlx0nuYs3kEN+yTeJSXguOtNH99TrtSZ4VMie\n" +
            "A5q2GIQ7TlCwsUQskjI3UG9o2ZjnwAyksB4CFsFvENIeZs/ecQ2Hx8bWdmgd75qB\n" +
            "kMS3S2qb8+5Dl/GfEjGBmDMvUF5lge72/lzo5SEQGLkbOiseQ2eBtjiKkBBavF3r\n" +
            "mpqpOaVUlpQ099EQoi1096AR+bAS1duSihs4BNF85e3EvztyZRb9YtbLxBOxXVoW\n" +
            "nW7Lcynih+VZXyBpY2Arq1RQBV2KWnxUr4Ulnh3p68ZEg7a8kDfC93gkO/w4r7T8\n" +
            "K5Gtq8GQNlcReT33lHy87Ar6O8fDs0+4lQXUslgP1bhOCXWuejJ7x5MIsFMDvA4o\n" +
            "J5ZTh5KtQmrS43LO8xgFvgeDgu4DcwIDAQABAoICABvwLN2csySbzi2SXg9IaXRd\n" +
            "0ThEVhVm5EvXiSmrroGqjfSka6YnwPqCLbmQ1yeMDdc35vO4+gkvyYshfyFjE763\n" +
            "TKcu1OU3imtFDx2vKC85Lk0XkFdXk5atc4ko4Ayjyg/7YPpoocBwBdvYo+gcWlZL\n" +
            "0+d1ZMpExvYfyEzQOlUGEa3oRu3eVJX78EnAasm0R8faA74yOtYVC+N7l66nBpDV\n" +
            "4LRDg3tm4tw1wKweWAtqunh2AG9sklFRb/paAk1tkY7Q2Pci2xqlSC5QOp9CRDLt\n" +
            "Ks071G6nS9tAwP/nIfcPRq6aOC6ptoE/Ec/iamUKKIB37XBSwrrO7TVr1Q4lpoi/\n" +
            "U0ueYuMo1L1ykqI7RWd7bzcVew/u8P90yghZC9k3Y+QSSeI93mbpHOv2DX1AeDeJ\n" +
            "eKC7VgSWB4IPozy2mDxkZJ6ettVlz5kKNJzuEM4TOeDEnGnwnGnB5v9pmNZViZAY\n" +
            "dbJClrk/pWhMcRcy5FNVLUZkqgLfJvWLk2BS7LSFugWcsR0THYymQc7FXDIs9JNE\n" +
            "VCmT/+g/i7sE/VHkLa65g4Irck1x1I3G9RHo9hF+2hMPtgWThPxtWd31q1ufZRyS\n" +
            "95zsUgbtdpZgKI1fSmYSGBpGPdMZH7WqojLJQ7aZCUjGGWW4aTe5lElhMYnIpVY2\n" +
            "3G9w0/ob7FkBjmZIqz9pAoIBAQD3HJ8Oa5enOD17+neseef5O+UEGbvd04wkWUSI\n" +
            "ca1rMHwFiHRzDAE8zjx+7cfdtLYPcGjex5+5oiNPHTqov0RT3HAEcj/tBWW0VCMH\n" +
            "yqw0LcYWdH8R4A68+2BFpHoObCRYh5MhsoR3vx82pV45/mrZC7CDTBxclQFbQyFO\n" +
            "wp/RUBavRDgotlNPj74Mn9soO/88cKixKZnhWz3gYjrbWIQe1D/YA5izjKEoNfOW\n" +
            "ElDaPqvXV662WklSVb8XzMUHzlEvs8K6d7klYtA2F9Oi+5Kn8vGF7byAbiaU1jaR\n" +
            "vUl02vcSHx8K/Kt5LyL+Z3hs7uDq17821sXiCSzVNJtdBkCtAoIBAQDWjPcmjV3/\n" +
            "GpKBftnIVfb6iiOUNev+0QjkJcW2hM+qeafTj4f7Spmg79rF3/1biqM3RaUZC2wT\n" +
            "CLD6x7TXMqHBXwdUGfiM8SmaAIRpOiH3Xfxp2C6seqUsRhmw+gIpDf8pSz4/m0QG\n" +
            "kIExM5UG6Rm2UMdNTh9b2vBG2pesq69w7VhN26sVZWyJl9EiMogiMgPQq4Gt5GMr\n" +
            "nXtPD+HAuA/mDk4lpQZTL4LdIuUunsLXfNBOKhfVa0SDuu7o0Xeaddax9xSafnRs\n" +
            "OD8KPikQC4luytQjGY+6EgVyWAvXyCaR7Tn2VpXhtlvi9/PUzsBmu5M8MTnNOxex\n" +
            "Ore6ilkEPjifAoIBAQC33UDv3thhILSG2e9PkwkqZglaCrfBLtV4ej9G8qZhOhsd\n" +
            "ltFmhMkq8B0NKGltKjfItxAgqxHKcryo8guiYWY6q6thc4zjE///tBa4hnGpBWH9\n" +
            "dULTDw6ISNXyG5aBwq8se/vat9ResQNNiq/YoNfplQwKNYhozqnKuOFAlAmMGXY3\n" +
            "hJ/wkvDcIwz6obrUbgfUddLetyB7EIOywAQhDvSHZ8/1L3/gIMQMglAzGn+0U6tS\n" +
            "uDgUEIu7ync8Ay2bSEUaJDvAuLI3AhYAGaxr+Zm+g0J4L1LxkIP+fIDv4ZKVcxMh\n" +
            "FazoZOZFbfAwsNZm3zrVIiBxck6ch80m+lSbW7qlAoIBAQChOmOMLBXj27MW7x13\n" +
            "p+omkmJ0QSUsYyd8U0pFg36PDEbq++RjGcdjInvT0SQSg5dttL+Bl4zKrPBaNHMY\n" +
            "eGsH5oKaV73pJF1v5k2ayd22h4FkhNlmMfAn2jH6RZYUBfmmrW2E3Qf8quD6+VlX\n" +
            "TRpOYFu1Iyz7mQaRKDlsv8PiZ+nA8H+bX5F1wImfWjvk/pLRX+DerU88+mYsnrG2\n" +
            "YltINZ3SOjYLkxuTVGLHavTefGQJKSap8acWGwboHGj1wPHq4NMx2i9hF89/wgCX\n" +
            "lyPbBz7tdYsFd/9x0upraHRbmtrA3IZbjO92G4C3ffsl+HWHeTKHoI2IWKiy3L5S\n" +
            "KvPfAoIBAQCA7lcY6vkiQNZbkA4Z8pKFox8XfhZm1ETSKS2AFX/whMxQDF9y8GXt\n" +
            "Y2/JrQxW7HbAQworRmR3gIYhULyHdRWc6HpN/GcLRgHuTwXh4gCFQTZqLegqJNmp\n" +
            "ZX7TBT0jlQCKSTRyBT5ystgGKCM56n4i+/oNsSFNbaGhwSUSiMI81EtQQsz7BARo\n" +
            "b9OKoMbUTxr2o0/nd+Mb2csS/NhbemCQpKx53R9toxoRJB3Q5SK+4BHLwvQCPA7Y\n" +
            "d49E4jVnJB10xPZgORbItHSPNAVJcqwxAVjkhnljfqfNfRfwaoVgdHApHSnRX7kN\n" +
            "mXOdeeEsMRrTmz029Z5WnD8bVVfKMPFz";

    /**
     * 默认密码
     */
    public static final String DEFAULT_PASSWORD = "123456";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

}
